<?php

	function readExcel()
	{
		$data = new Spreadsheet_Excel_Reader();
		$data->setUTFEncoder('iconv');
		$data->setOutputEncoding('CP1251');
		$data->read("data/data.xls");

		for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
			$index = 0;
			for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {

				if($data->sheets[0]['cells'][1][$j] == "Testcase"){
					$opt[$index]["Testcase"] =  $data->sheets[0]['cells'][$i][$j];
				}

				if($data->sheets[0]['cells'][1][$j] == "Keyword"){
					$opt[$index]["Keyword"] =  $data->sheets[0]['cells'][$i][$j];
				}

				if($data->sheets[0]['cells'][1][$j] == "Enabled"){
					$opt[$index]["Enabled"] =  $data->sheets[0]['cells'][$i][$j];
				}

				if($data->sheets[0]['cells'][1][$j] == "Parameter"){
					$opt[$index]["Parameter"] =  $data->sheets[0]['cells'][$i][$j];
				}

			}
			$index++;
		}
		return $opt;
	}


	function goFromFirstToLastPage($browser)
	{
		$control = new submitButton($browser);
		$buttons = $control->getAllButton();
		if(count($buttons)>0){
			$button_str = implode("",$buttons);
			if(strlen($button_str)==0) {
				return;
			}
			//$control->click($buttons[2]);
			$control->click("//input[@class='nextArrowEnable IE6trans']");
			$browser->waitForPageToLoad(20000);
			goFromFirstToLastPage($browser);
		}
	}

	function setDataToSession ($varName, $val) {
		if(strlen($varName) > 0){
			$extra = explode(",",$varName);
			foreach($extra as $vals) {
				$extra1 .= "['".$vals."']";
			}
			eval("\$value = &\$_SESSION['dc']{$extra1};");
			$value = $val;
		}
	}

	function &getDataFromSession ($varName){
		if(strlen($varName) > 0){
			$extra = explode(",",$varName);
			//$extra1 = "$"."_SESSION['dc']";
			foreach($extra as $vals) {
				$extra1 .= "['".$vals."']";
			}
			eval("\$value = &\$_SESSION['dc']{$extra1};");
			return $value;
		}
	}


?>